<?php

class Maquinas_model extends CI_Model {
    public function __construct() {
        $this->load->database();
    }
    
    public function set($datos) {
        $this->db->insert('maquinas', $datos);
        return $this->db->insert_id();
    }
    
    public function gets() {
        $query = $this->db->query("SELECT *
                                    FROM
                                        maquinas
                                    ORDER BY
                                        marca, modelo");
        return $query->result_array();
    }
    
    public function get($idmaquina) {
        $query = $this->db->query("SELECT *
                                    FROM
                                        maquinas
                                    WHERE
                                        idmaquina = '$idmaquina'");
        return $query->row_array();
    }
    
    public function update($datos, $id) {
        $this->db->update('maquinas', $datos, array('idmaquina' => $id));
    }
}
?>
